package testing;

import infrastructure.HasherService;
import infrastructure.LoggingManager;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import app_kvClient.KVClient;
import app_kvEcs.ServerInfo;
import app_kvServer.KVServer;
import junit.framework.Test;
import junit.framework.TestSuite;
import logger.LogSetup;


public class AllTests {

	private static Logger logger = LoggingManager.CreateClientLogger(AllTests.class);
	
	static {
		//new LogSetup("logs/testing/test.log", Level.ERROR);
		Map<String, String> metadata = new HashMap<String, String>();
		HasherService hasherService = null;
		try {
			hasherService = new HasherService();
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		List<String> ranges = hasherService.getUpperBoundHashRangeSorted(1);		
		ServerInfo si = new ServerInfo("127.0.0.1", 5000);
		KVServer server = new KVServer(50000, ranges.get(0), si.toString(), si.toString());		
	}
	
	
	public static Test suite() {
		logger.info("Creating Test suit");
		TestSuite clientSuite = new TestSuite("Basic Storage ServerTest-Suite");
		clientSuite.addTestSuite(ConnectionTest.class);
		clientSuite.addTestSuite(InteractionTest.class); 
		clientSuite.addTestSuite(AdditionalTest.class); 
		return clientSuite;
	}
	
}
